package com.slofzx.nuoda.evaluation.controller;

import com.slofzx.nuoda.common.enums.ServiceResult;
import com.slofzx.nuoda.common.vo.AjaxResultVO;
import com.slofzx.nuoda.evaluation.service.SyncService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/sso/sync")
public class SsoUserController {
    @Autowired
    private SyncService syncService;

    /**
     * 同步用户接口
     * @return
     */
    @RequestMapping("/user")
    @RequiresPermissions("sys_user:sync")
    public AjaxResultVO syncUser() {
        final ServiceResult sync = syncService.syncUser();
        return AjaxResultVO.getInstance(sync);
    }

    /**
     * 同步用户接口
     * @return
     */
    @RequestMapping("/office")
    @RequiresPermissions("sys_office:sync")
    public AjaxResultVO syncOffice() {
        final ServiceResult sync = syncService.syncOffice();
        return AjaxResultVO.getInstance(sync);
    }
}
